
package org.example.domain.model.entity.url;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
@Builder
@TableName("url_shortener")
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "短链接实体")
public class UrlShortener {

    @Schema(description = "短链接主键ID")
    private Long id;

    @Schema(description = "域名")
    private String domain;

    @Schema(description = "短链接")
    private String shortUri;

    @Schema(description = "完整短链接")
    private String fullShortUrl;

    @Schema(description = "原始链接")
    private String originUrl;

    @Schema(description = "点击量")
    private Integer clickNum;

    @Schema(description = "分组标识")
    private String gid;

    @Schema(description = "启用标识 0：启用 1：未启用")
    private Integer enableStatus;

    @Schema(description = "创建类型 0：接口创建 1：控制台创建")
    private Integer createdType;

    @Schema(description = "有效期类型 0：永久有效 1：自定义")
    private Integer validDateType;

    @Schema(description = "有效期")
    private Date validDate;

    @Schema(description = "描述")
    private String description;

    @Schema(description = "网站标识")
    private String favicon;

    @Schema(description = "历史PV")
    private Integer totalPv;

    @Schema(description = "历史UV")
    private Integer totalUv;

    @Schema(description = "历史UIP")
    private Integer totalUip;

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @Schema(description = "删除标识, true:已删除, false:未删除")
    @TableField(fill = FieldFill.INSERT)
    private Boolean deleteIdentity;

    @Schema(description = "删除时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyy-MM-dd HH:mm:ss")
    private Date delTime;

    @Schema(description = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @Schema(description = "今日PV")
    @TableField(exist = false)
    private Integer todayPv;

    @Schema(description = "今日UV")
    @TableField(exist = false)
    private Integer todayUv;

    @Schema(description = "今日UIP")
    @TableField(exist = false)
    private Integer todayUip;


}
